<?php

namespace App\Model\Baiyou;

use App\Model\BaseModel;
use EasySwoole\EasySwoole\Config;
use EasySwoole\ORM\Utility\Schema\Table;


/**
 *
 * This is the model class for table "{{%api_access_token}}".
 *
 * @property string $id
 * @property string $refresh_token 刷新令牌
 * @property string $access_token 授权令牌
 * @property string $member_id 用户id
 * @property int $status 状态[-1:删除;0:禁用;1启用]
 * @property string $created_at 创建时间
 * @property string $updated_at 修改时间
 */
class ApiAccessToken extends BaseModel
{
    // 指定连接名称
//    protected $connectionName = 'dengta';

    public function __construct(array $data = [])
    {
        $tablePrefix = Config::getInstance()->getConf("MYSQL.tablePrefix");
        $name = $tablePrefix . "api_access_token";
        $this->tableName($name);

        parent::__construct($data);
    }

    /*protected $casts = [
        'id'            => 'int',
        'parent_id'     => 'int',
        'title'         => 'string',
        'url'           => 'string',
    ];*/

    /**
     * 表的获取
     * 此处需要返回一个 EasySwoole\ORM\Utility\Schema\Table
     * @return Table
     */
    /*public function schemaInfo(bool $isCache = true): Table
    {
        $table = new Table($this->tableName);
        $table->colInt('id')->setIsPrimaryKey(true)->setIsAutoIncrement(true);
        $table->colVarChar('refresh_token', 60);
        $table->colVarChar('access_token', 60);
        $table->colInt('member_id')->setIsUnsigned(true);
        $table->colVarChar('openid', 60);
        $table->colVarChar('group', 30);
        $table->colInt('status');
        $table->colInt('create_time');
        $table->colInt('update_time');

        return $table;
    }*/
}
